package com.cos.config;

import com.cos.constant.MQ;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ItemConfig {

    @Bean
    public FanoutExchange getTopicExchange(){
        return new FanoutExchange (MQ.GOODS_EXCHANGE,true,false);
    }

    @Bean
    public Queue getItemQueue(){
        return new Queue(MQ.GOODS_ITEM_QUEUE,true,false,false);
    }

    @Bean
    public Binding getItemBinding(){
        return BindingBuilder.bind(getItemQueue()).to(getTopicExchange());
    }
}
